<template>
	<view class="container">
		<view v-for="(value, key) in registrationList" :key="key" class="content">
			<view class="item title">挂号记录</view>
			<view class="item">挂号流水：<span class="item-content">{{value.regId}}</span></view>
			<view class="item">预约日期：<span class="item-content">{{value.visitDate}}</span></view>
			<view class="item">预约时间：<span class="item-content">{{value.subsectionType==1?"上午":value.subsectionType==2?"下午":value.subsectionType==3?"晚上":""}}</span></view>
			<view class="item">就诊科室：<span class="item-content">{{getDeptName(value.deptId)}}</span></view>
			<view class="item">就诊状态：<span class="item-content">{{getRegStatus(value.regStatus)}}</span></view>
			<view class="item GhDetail" @click="goCareOrderItem(value.regId,value.regStatus)">查看详细</view>
		</view>
	</view>
</template>

<script>
	import{
		getRegistrationListById
	} from '@/api/registration/index.js'
	export default {
		data() {
			return {
				registrationList: [],
			}
		},
		async onLoad() {
			getRegistrationListById(uni.getStorageSync('patient').patientId).then(res=>{
				this.registrationList= res.data
			})
		},
		methods: {
			goCareOrderItem(regId,regStatus){
				uni.setStorageSync('regId', regId)
				uni.setStorageSync('regStatus',regStatus)
				uni.navigateTo({
					url: '/pages/historyGH/detail'
				})
			},
			getDeptName(deptId){
				if(deptId==101){
					return "内科"
				}else if(deptId==102){
					return "外科"
				}else if(deptId==103){
					return "儿科"
				}else if(deptId==104){
					return "妇科"
				}else if(deptId==105){
					return "眼科"
				}else if(deptId==106){
					return "耳鼻喉科"
				}else if(deptId==107){
					return "口腔科"
				}else if(deptId==108){
					return "皮肤科"
				}
			},
			getRegStatus(regStatus){
				if(regStatus==0){
					return "未收费"
				}else if(regStatus==1){
					return "待就诊"
				}else if(regStatus==2){
					return "就诊中"
				}else if(regStatus==3){
					return "就诊完成"
				}else if(regStatus==4){
					return "已退号"
				}else if(regStatus==5){
					return "作废"
				}
			},
		}
	}
</script>

<style lang="scss">
	.container{
		background-color: #F4F4F6;
		width: 100%;
		height: 100%;
	}
	.content {
		padding-top: 10px;
	}
	
	page {
		.item {
			height: 35px;
			line-height: 35px;
			margin: 5px 15px;
			padding-left: 10px;
			font-size: $font-size-sm;
			color: #333333;
			background-color: white;
		}
		.title {
			font-size: $font-size-base;
			font-weight: bold;
			background-color: #E2E2E2;
		}
		.GhDetail {
			color: #3F80FF;
			text-align: center;
			height: 45px;
			line-height: 45px;
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
		}
		.item-content {
			float: right;
			margin-right: 10px;
			color: #6A6A6A;
			font-size: $font-size-sm;
		}
	}
</style>